package com.qingxin.sys.verifier;

import java.util.ArrayList;
import java.util.List;

/**
 * 保存表单验证信息
 * @author Administrator
 *
 */
public class FormMsg {

	private boolean pass;
	private Form form;
	private List<VerifyMsg> messages = new ArrayList<VerifyMsg>();
	
	
	public FormMsg(Form form) {
		this.form = form;
	}
	
	
	public boolean isPass() {
		return pass;
	}
	public FormMsg setPass(boolean pass) {
		this.pass = pass;
		return this;
	}
	public Form getForm() {
		return form;
	}
	public void setForm(Form form) {
		this.form = form;
	}
	public List<VerifyMsg> getMessages() {
		return messages;
	}
	public void addMessage(VerifyMsg message){
		messages.add(message);
	}
	public VerifyMsg getFirstMessage(){
		if(messages.size() > 0){
			return messages.get(0);
		}
		return null;
	}
	public String getFirstErrorMessage(){
		if(messages.size() > 0){
			return messages.get(0).getLabelMessage(false);
		}
		return "验证不通过";
	}
	
}
